home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 46 / Amiga Format CD46 (1999-10-20)(Future Publishing)(GB)[!][issue 1999-12].iso / -serious- / programming / other / tandem / teaching / 72.asm < prev    next >
Assembly Source File  |  1999-09-06  |  2KB  |  85 lines

  1. * 72.asm     TLdropdown    version 0.00    8.9.99
  2.  
  3.  
  4.  include 'Front.i'
  5.  
  6.  
  7. ; The program draws & monitors a drop down menu. If you wanted it to be
  8. ; a cycle gadet, you'd put 'cycle' for \8, like this:
  9. ;
  10. ; To draw:
  11. ;
  12. ;     TLdropdown draw,#4,#6,mood,#20,#25,,cycle  ;draw
  13. ;
  14. ; To monitor;
  15. ;
  16. ;     TLdropdown monitor,#4,#6,mood,#20,#25,,cycle   ;monitor
  17.  
  18.  
  19. mood: ds.l 1              ;holds the operative mood (1+)
  20.  
  21.  
  22. strings: dc.b 0
  23. st_1: dc.b 'TLdropdown demo',0 ;1
  24.  dc.b 'Error: out of chip memory',0 ;2
  25.  dc.b 'Choose a mood, or click the window close gadget',0 ;3
  26.  dc.b 'Happiness is',0 ;4
  27.  dc.b 'Sadness is',0 ;5
  28.  dc.b 'Boredom is',0 ;6
  29.  dc.b 'Fascination is',0 ;7
  30.  dc.b 'Fear is',0 ;8
  31.  dc.b 'Relief is',0 ;9
  32.  dc.b 'Someone gets JAVA working on Amiga',0 ;10
  33.  dc.b 'People are buying PCs             ',0 ;11
  34.  dc.b 'Downloading a newsgroup           ',0 ;12
  35.  dc.b 'The Amiga workbench               ',0 ;13
  36.  dc.b 'Programming a printer driver      ',0 ;14
  37.  dc.b 'I didn''t crash                    ',0 ;15
  38.  dc.b '(I should reappear when the drop down disappears)',0 ;16
  39.  
  40.  ds.w 0
  41.  
  42.  
  43. * demonstrate TLdoprdown
  44. Program:
  45.  TLwindow #0,#0,#0,#200,#40,#640,#200,#0,#st_1
  46.  beq Pr_bad
  47.  
  48. Pr_resize:                 ;here if window resized
  49.  TLreqcls                  ;clear window
  50.  TLstring #3,#20,#10       ;print instructions
  51.  TLstring #16,#20,#58      ;writing underneath
  52.  move.l #1,mood            ;initialise mood
  53.  
  54.  TLdropdown draw,#4,#6,mood,#20,#25    ;draw with initial mood
  55.  
  56. Pr_report:                 ;report mood so far
  57.  moveq #9,d0
  58.  add.l mood,d0
  59.  TLstring d0,#154,#26
  60.  
  61. Pr_wait:                   ;wait for user response
  62.  TLwcheck                  ;go if window resized
  63.  bne Pr_resize
  64.  TLkeyboard                ;get input
  65.  cmp.b #$93,d0
  66.  beq Pr_quit               ;quit if close window
  67.  cmp.b #$1B,d0
  68.  beq Pr_quit               ;quit if Esc
  69.  cmp.b #$80,d0
  70.  bne Pr_wait               ;else ignore unless lmb
  71.  
  72.  move.l d1,xxp_kybd+4(a4)
  73.  move.l d2,xxp_kybd+8(a4)
  74.  TLdropdown monitor,#4,#6,mood,#20,#25,,#5  ;monitor dropdown
  75.  beq Pr_wait
  76.  
  77.  move.l d0,mood            ;set new mood
  78.  bra Pr_report             ;report response, wait for next
  79.  
  80. Pr_bad:
  81.  TLbad #2
  82.  
  83. Pr_quit:
  84.  rts
  85.